<%-- 
    Document   : userAndorid
    Created on : 22.6.2011, 21:55:
    Author     : Ruzin

--%>

<%@page import="com.zproekt.entity.Termin"%>
<%@page import="com.zproekt.servis.OrdinacijaCRUD"%>
<%@page contentType="xml" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

    
<% com.zproekt.entity.Pacient pacient = OrdinacijaCRUD.getPacient(Long.valueOf(request.getSession().getValue("id").toString()));
    pageContext.setAttribute("pacient", pacient);
    java.util.List<Termin> termin = OrdinacijaCRUD.getTerminUnijaPacient(Long.valueOf(request.getSession().getValue("id").toString()));
    pageContext.setAttribute("termin", termin);
%>
<% String greska = request.getParameter("error");
                if (greska != null) {
                    if (greska.equals("pominato")) {
                        out.println("<error>Date passed</error>");
                    }
                    if (greska.equals("postoi")) {
                        out.println("<error>Date exists</error>");
                    }
                };
                String success = request.getParameter("success");
                if (success != null) {
                    if (success.equals("vnesenTermin")){
                        out.println("<success>Booked</success>");
                    }
                }
                
            %>
<podatoci>
    <korisnik>
        <id>${pacient.getId()}</id>
        <ime>${pacient.getIme()}</ime>
        <prezime>${pacient.getPrezime()}</prezime>
        <embg>${pacient.getEmbg()}</embg>
    </korisnik>
    <termini>
    <c:forEach var="termin" items="${termin}">
        <termin>        
            <idter>${termin.getId()}</idter>
            <datum>${termin.getDatum()}</datum>
            <vreme>${termin.getVreme()}</vreme>
            <tretman>${termin.getTretman()}</tretman>
        </termin>
    </c:forEach>
    </termini>
</podatoci>
